from artifacts.base.sr.base_relics import Relics
from artifacts.base.sr.relics_factory import RelicsFactory
from artifacts.evaluate.sr.billet_evaluate import evaluate, need_type


def once_need_times(display=True):
    times = 0
    salvage_count = 0
    while True:
        times += 1
        relics = RelicsFactory.create_out_relics_list()
        if salvage_count >= 10:
            salvage_count -= 10
            relics += [need_type(Relics.SUIT_A)]
        for relic in relics:
            relic.upgrade_one_bonus()
            if evaluate(relic):
                if display:
                    print(relic)
                return times
            else:
                salvage_count += 1
